count = 0
while True:
        s = input().strip()
        if s == '.':
            break
        count += s.count("a")
print(count)
